package com.itcast.activiti.entity;

import java.time.LocalDateTime;
import java.io.Serializable;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import lombok.experimental.FieldNameConstants;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * 审批定义表
 * </p>
 *
 * @author itcast
 * @since 2021-02-25
 */
@Data
@FieldNameConstants
@EqualsAndHashCode(callSuper = false)
public class ApproveDefinition implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    private String id;

    /**
     * 父ID（0：模板）
     */
    private String parentId;

    /**
     * 租户id
     */
    @NotBlank(message = "tenantId is empty")
    private String tenantId;

    /**
     * 审批类型：1：出勤休假）2：财务）3：人事）4：行政）5：其他）
     */
    private Integer groupType;

    /**
     * 审批名称
     */
    @NotBlank(message = "name is empty")
    private String name;

    /**
     * 图标
     */
    private String icon;

    /**
     * 审批说明
     */
    private String description;

    /**
     * 审批意见填写提示
     */
    private String opinionPrompt;

    /**
     * 审批意见是否必填
     */
    private Integer opinionRequired;

    /**
     * 谁可以发起这个审批json
     */
    private String userRange;

    /**
     * 流程json nocond
     */
    private String flowJson;
    private String flowDataJson;

    /**
     * 数据来源 0：初始化）1：新增）2：回退）3：加签）4：只会）
     */
    private Integer dataFrom;

    /**
     * 是否删除
     */
    private Boolean deleted;

    /**
     * 删除时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime deletedDatetime;

    /**
     * 删除人
     */
    private String deletedBy;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime createdDatetime;

    /**
     * 创建人
     */
    private String createdBy;

    /**
     * 修改时间
     */
    @TableField(fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime modifiedDatetime;

    /**
     * 修改人
     */
    private String modifiedBy;


}
